<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="#{webContext.skin0Culomns}"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">

    <ui:define name="center">
        #{secureUserEdit.checkPermisson()}
        #{secureUserEdit.initUser(param["p1"])}
        <h:form id="editUserForm">
            <p:growl globalOnly="true" id="messages" showDetail="true"/>
            <p:breadCrumb>  
                <p:menuitem value="#{ml.tr('Home')}" url="#{webContext.baseUrl}" />  
                <p:menuitem value="#{ml.tr('User list')}" url="#{lm.ml('secure/user/list.xhtml')}" />  
                <p:menuitem value="#{ml.tr('Edit user')}" url="#" />   
            </p:breadCrumb>
            <p:toolbar>
                <p:toolbarGroup align="left">
                    <p:commandButton 
                        actionListener="#{secureUserEdit.edit()}"
                        update="editUserForm"
                        image="ui-icon ui-icon-disk"
                        value="#{ml.tr('Save')}"/>
                </p:toolbarGroup>
            </p:toolbar>
            <p:tabView>
                <p:tab title="#{ml.tr('Info')}"> 
                    <p:panel id="userPanel"
                             header="#{secureUserEdit.user.firstname} #{secureUserEdit.user.lastname}" 
                             >
                        <h:panelGrid id="confirmation" columns="6" cellspacing="10">
                            <h:outputText value="#{ml.tr('Name')}: " />
                            <h:inputText styleClass="outputLabel"
                                         value="#{secureUserEdit.user.firstname}" />

                            <h:outputText value="#{ml.tr('Surname')}: " />
                            <h:inputText  styleClass="outputLabel"
                                          value="#{secureUserEdit.user.lastname}"/>
                            
                            <h:outputText value="#{ml.tr('Username')}: " />
                            <h:inputText  styleClass="outputLabel"
                                          value="#{secureUserEdit.user.username}"/>

                            <h:outputText value="#{ml.tr('Street')}: " />
                            <h:inputText styleClass="outputLabel"
                                         value="#{secureUserEdit.user.street}" />

                            <h:outputText value="#{ml.tr('ZIP')}: " />
                            <h:inputText styleClass="outputLabel"
                                         value="#{secureUserEdit.user.postalCode}" />

                            <h:outputText value="#{ml.tr('City')}: " />
                            <h:inputText styleClass="outputLabel"
                                         value="#{secureUserEdit.user.city}" />

                            <h:outputText value="#{ml.tr('Email')}: " />
                            <h:inputText styleClass="outputLabel"
                                         value="#{secureUserEdit.user.email}" />

                            <h:outputText value="#{ml.tr('Phone')}: " />
                            <h:inputText styleClass="outputLabel"
                                         value="#{secureUserEdit.user.phone}"/>

                            <h:outputText value="#{ml.tr('Additional information')}: " />
                            <h:inputText styleClass="outputLabel"
                                         value="#{secureUserEdit.user.info}" />
                        </h:panelGrid>
                    </p:panel>
                </p:tab>
                <p:tab title="#{ml.tr('Permissions')}" >
                    <p:dataTable id="userList" var="group" value="#{secureGroupList.allGroups}"
                                 paginator="true" rows="#{constants.DATATABLE_ROWS}"
                                 selection="#{secureUserEdit.selectedGroups}">

                        <f:facet name="header">
                            "#{ml.tr('List of groups')}"
                        </f:facet>
                        <p:column selectionMode="multiple" />

                        <p:column filterBy="#{group.name}"
                                  headerText="#{ml.tr('Name')}"
                                  filterMatchMode="contains">
                            <h:outputText value="#{group.name}" />
                        </p:column>
                    </p:dataTable>
                </p:tab>
            </p:tabView>
        </h:form>

    </ui:define>

</ui:composition>
